package net.kong.sns.rest.client.friend.json;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;

import net.kong.sns.rest.client.model.FriendInfo;
import net.kong.sns.rest.client.ClientTestBase;
import net.kong.sns.rest.client.ClientException;

import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;


/**
 * @author yk
 * @version $Id: Friends_GetAppUsers_Info.java,v 1.6 2009/11/04 17:44:56 ningyubin Exp $
 */
@RunWith(Parameterized.class)
public class Friends_GetAppUsers_Info extends ClientTestBase {

    private List<FriendInfo> friends_getAppUsers_info_ret;

    public Friends_GetAppUsers_Info(String file, List<FriendInfo> friends_getAppUsers_info_ret) {
        super(Friend_Get_Id.class.getResourceAsStream(file));
        this.friends_getAppUsers_info_ret = friends_getAppUsers_info_ret;
    }

    @Parameters
    public static Collection<Object[]> testData() {
        return Arrays.asList(new Object[][]{{"Friends_GetAppUsers_Info_1.xml", new ArrayList<FriendInfo>() {

            {
                add(new FriendInfo(12345676, "test1", false, true));
                add(new FriendInfo(12345677, "test2", true, false));
            }
        }}});
    }

    @Test(expected = ClientException.class)
    public void friends_getAppUsers_info() {
        List<FriendInfo> ret = client.friends_getAppUsers_info();
        Assert.assertEquals(friends_getAppUsers_info_ret, ret);
        Assert.assertEquals("1", ((Object[]) parameterMap.get("format"))[0]);
        Assert.assertEquals("json", ((String[]) parameterMap.get("response_format"))[0]);
        Assert.assertEquals("1.0", ((String[]) parameterMap.get("v"))[0]);
        client_noSessionKey.friends_getAppUsers_info();
    }
}
